<div id="content">
	<div class="row s_page_title">
		<sa-big-breadcrumbs [items]="['环卫管理','车载屏幕','设置警报阈值']" icon="fa fa-cube" class="col-xs-12 col-sm-7 col-md-7 col-lg-4"></sa-big-breadcrumbs>
	</div>
	<sa-widgets-grid>
		<div class="s_table">
			<div sa-widget [editbutton]="false" color="darken" class="clearfix">
				<header><span class="widget-icon"> <i class="fa fa-table"></i> </span>
					<h2>设置警报阈值</h2>
				</header>
				<div>
					<div class="widget-body no-padding">
						<div class="page-header clearfix s_table_opreation">
							<div class="left page-header-btn">
								<sa-company-tree-car companyTreeId="companyTree" (companySelected)="companySelected($event)"></sa-company-tree-car>
								<!--<div class="top_module top_module_box" style="min-width: auto;">
									<span class="top_module_label module_text">时间类型</span>
									<select name="" class="top_module_select" [(ngModel)]="timeType" style="min-width: 110px;">
										<option value="1">称重时间</option>
										<option value="2">创建时间</option>
									</select>
								</div>-->
								<div class="selectDate top_module">
									<table-select-date [notInit]='true' (outerTime)="getSelectTableTime($event)" [specifyTime]='initDateRange'></table-select-date>
								</div>
								<button type="button" class="btn btn-primary" (click)="table_search()">查询</button>
								<!--<button type="button" class="btn btn-primary" (click)="exportData()">导出</button>-->
								<button type="button" class="btn btn-primary" (click)="addRow(thresholdFromModal)">新增</button>
								<button type="button" class="btn btn-primary" (click)="clearRow(clearModal)">清零</button>
							</div>
							<div class="right top-search">
								<input type="text" [(ngModel)]="searchKey" (change)="table_search()" class="search-input" placeholder="车牌号">
								<span class="top-search-box">
									<button class="top-search-btn" type="button" (click)="table_search()"> <i class="fa fa-search"></i></button>
								</span>
							</div>
						</div>
						<div class="table_scroll">
							<table class="display dataTables responsive table table-striped table-bordered table-hover dataTable s_h5_table">
								<thead>
									<tr>
										<th>车牌号码</th>
										<th>设备ID</th>
										<th>公司名称</th>
										<th>超速阈值</th>
										<th>超速时长</th>
										<th>超载阈值</th>
										<th>超载时长</th>
										<th>创建来源</th>
										<th>上次指令下发时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<tr *ngFor="let row of tableData">
										<!-- <td>
										    <button type="button" (click)="jumpCarList(row)" title="跳转车辆管理页面">{{row.carNumber}}</button>
										</td> -->
										<td>{{row.carNumber}}</td>
										<td>{{row.deviceId}}</td>
										<td>{{row.companyName}}</td>
										<td>{{row.overSpeed}}</td>
										<td>{{row.speedingTime}}</td>
										<td>{{row.overLoad}}</td>
										<td>{{row.overLoadTime}}</td>
										<td>{{row.updateSource}}</td>
										<td>{{row.commandTime}}</td>
										<td>
											<button type="button" (click)="editRow(row,thresholdFromModal)">编辑</button>
											<button type="button" (click)="issueInstructions(row)">下发指令</button>
										</td>
									</tr>
								</tbody>
							</table>
						</div>
						<div class="table-fix clearfix">
							<paginator [totalRecords]="totalCount" [rows]="pageSize" [currentPage]="curPage - 1" (onPageChange)="paginate($event)">
							</paginator>
							<button type="button" class="btn default refresh_btn" (click)="refresh()"><i class="fa fa-refresh"></i></button>
						</div>
					</div>
				</div>
			</div>
		</div>
	</sa-widgets-grid>
	<!--  新增和编辑 -->
	<div bsModal #thresholdFromModal="bs-modal" id="lgModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg" style="width: 800px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="modalClose(thresholdFromModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title"><span *ngIf="formType == 'new'">新增</span><span *ngIf="formType == 'update'">编辑</span>阈值</h4>
				</div>
				<div class="modal-body">
					<div class="row">
						<form id="thresholdValFrom" class="form-horizontal" role="form" novalidate="novalidate" [saBootstrapValidator]="validatorOptions">
							<div class="row">
								<div class="form-group col-xs-12 s_fix_select2_width s_fix_select2">
									<label class="control-label col-xs-3" for="newPassword">车牌号码<sup>*</sup></label>
									<div class="col-xs-9" *ngIf="formType == 'new'">
										<input type="hidden" class="form-control" name="carNumberFrom" id="carNumberFrom" [(ngModel)]='thresholdFrom.carNumber' />
										<sa-select2 select2ElementID="carSelect2" (optionSelected)="optionSelected($event)" matchSearch="true"></sa-select2>

										<!--<div class="s_hover_box"  [ngStyle]="{display:formType == 'new'?'block':'none'}">
                                            <select   class="select2" name="userName" id="userNameSelect2From">
                                                <option value=''></option>
                                            </select>
                                            <div class="s_del_icon" (click)='delUserNameFrom()'>x</div>
										</div>-->
									</div>
									<div class="col-xs-9" *ngIf="formType == 'update'">
										<input class="form-control" name="carNumberFrom" id="carNumberFrom" [(ngModel)]='thresholdFrom.carNumber' readonly/>
									</div>
								</div>
								<div class="form-group col-xs-12">
									<label class="control-label col-xs-3">设备ID<sup>*</sup></label>
									<div class="col-xs-9">
										<input class="form-control" name="deviceId" readonly [(ngModel)]='thresholdFrom.deviceId' />
									</div>
								</div>
								<div class="form-group col-xs-12">
									<label class="control-label col-xs-3">超速阈值<sup>*</sup></label>
									<div class="col-xs-9">
										<input class="form-control" name="overSpeed" [(ngModel)]='thresholdFrom.overSpeed' />
									</div>
								</div>
								<div class="form-group col-xs-12">
									<label class="control-label col-xs-3">超速时长<sup>*</sup></label>
									<div class="col-xs-9">
										<input class="form-control" name="speedingTime" [(ngModel)]='thresholdFrom.speedingTime' />
									</div>
								</div>
								<div class="form-group col-xs-12">
									<label class="control-label col-xs-3">超载阈值<sup>*</sup></label>
									<div class="col-xs-9">
										<input class="form-control" name="overLoad" [(ngModel)]='thresholdFrom.overLoad' />
									</div>
								</div>
								<div class="form-group col-xs-12">
									<label class="control-label col-xs-3">超载时长<sup>*</sup></label>
									<div class="col-xs-9">
										<input class="form-control" name="overLoadTime" [(ngModel)]='thresholdFrom.overLoadTime' />
									</div>
								</div>
							</div>
							<div class="modal-footer">
								<button type="button" class="btn btn-default" (click)="modalClose(thresholdFromModal)">取消</button>
								<button type="button" class="btn btn-primary" (click)="modalSubmit(thresholdFromModal)">确认</button>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--弹窗end-->

	<!--  清零确认-->
	<div bsModal #clearModal="bs-modal" id="lgModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
		<div class="modal-dialog modal-lg" style="width: 800px;">
			<div class="modal-content">
				<div class="modal-header">
					<button type="button" class="close" (click)="clearmodalClose(clearModal)" aria-label="Close"><span aria-hidden="true">&times;</span></button>
					<h4 class="modal-title">清零操作</h4>
				</div>
				<div class="modal-body">
					<div class="row form-horizontal">
						<div class="form-group col-xs-12 s_fix_select2_width s_fix_select2">
							<label class="control-label col-xs-3" for="newPassword">车牌号码<sup>*</sup></label>
							<div class="col-xs-7">
								<input type="hidden" class="form-control" name="clearCarNumberFrom" id="clearCarNumberFrom" [(ngModel)]='clearObj.carNumber' />
								<sa-select2 select2ElementID="clearCarSelect2" (optionSelected)="clearCarSelected($event)" matchSearch="true"></sa-select2>
							</div>
						</div>
						<div class="form-group col-xs-12">
							<label class="control-label col-xs-3">设备ID<sup>*</sup></label>
							<div class="col-xs-7">
								<input class="form-control" name="clearDeviceId" readonly [(ngModel)]='clearObj.deviceId' />
							</div>
						</div>
					</div>
				</div>
				<div class="modal-footer">
					<button type="button" class="btn btn-default" (click)="clearmodalClose(clearModal)">取消</button>
					<button type="button" class="btn btn-primary" (click)="clearmodalSubmit(clearModal)">确认清零</button>
				</div>
			</div>
		</div>
	</div>
	<!--弹窗end-->
</div>